package edu.just.pet.service.impl;

import com.github.pagehelper.PageHelper;
import edu.just.pet.dao.DogDao;
import edu.just.pet.entity.Dog;
import edu.just.pet.service.DogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DogServiceimpl implements DogService {
    @Autowired
    private DogDao dogDao;
    @Override
    public List<Dog> getDogListByPage(Dog dog) {
        if(dog.getPage() != null && dog.getLimit() != null) {
            PageHelper.startPage(dog.getPage(), dog.getLimit());
        }

        return dogDao.getDogListByPage(dog);
    }

    @Override
    public Integer getDogListCount(Dog dog) {
        return dogDao.getDogListCount(dog);
    }

    @Override
    public Integer deleteDog(Dog dog) {
        return dogDao.deleteDog(dog);
    }

    @Override
    public Integer deleteDogList(List<Dog> dogList) {
        return dogDao.deleteDogList(dogList);
    }

    @Override
    public Integer addDog(Dog dog) {
        return dogDao.addDog(dog);
    }

    @Override
    public Integer updateDog(Dog dog) {
        return dogDao.updateDog(dog);
    }

    @Override
    public Integer adop(Dog dog) {
        return dogDao.adop(dog);
    }

    @Override
    public Dog getDogInfoById(Dog dog) {
        return dogDao.getDogInfoById(dog);
    }
}
